package com.zhiyou100.review.day021.socket;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @packageName: Demo07ChatClient
 * @className: com.zhiyou100.review.day021.socket
 * @Description: TODO
 * @author: yang
 * @date: 7/3/20
 */
public class Demo07ChatClient {

    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 10000);
        // 创建 连接 指定服务器的端口和 ip

        Scanner scanner = new Scanner(System.in);


        InputStream inputStream = socket.getInputStream();
        OutputStream outputStream = socket.getOutputStream();
        // 获取输入和输出


        socket.close();


    }
}

class SendThread extends Thread {
    OutputStream out;
    Scanner scanner = new Scanner(System.in);

    @Override
    public void run() {
        while (true) {
            String s = scanner.nextLine();
            try {
                out.write(s.getBytes());
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (s.endsWith("END")) {
                break;
            }
        }
    }
}

class ReceiveThread extends Thread {
    InputStream in;

    @Override
    public void run() {
        while (true) {

        }
    }
}